package com.smalls.redshoes.util;

import android.graphics.Camera;
import android.graphics.Matrix;
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.widget.ImageView;

public class VodDeaitlPic extends Animation {
    private Camera mCamera;
    private final float mCenterX;
    private final float mCenterY;

    public VodDeaitlPic(ImageView child) {
        this.mCenterY = (float) child.getLayoutParams().height;
        this.mCenterX = (float) child.getLayoutParams().width;
    }

    public void initialize(int width, int height, int parentWidth, int parentHeight) {
        super.initialize(width, height, parentWidth, parentHeight);
        this.mCamera = new Camera();
    }

    protected void applyTransformation(float interpolatedTime, Transformation t) {
        this.mCamera.save();
        Matrix matrix = t.getMatrix();
        float imageHeight = this.mCenterY;
        float imageWidth = this.mCenterX;
        this.mCamera.translate(0.0f, 0.0f, -20.0f);
        this.mCamera.rotateY(15.0f);
        this.mCamera.getMatrix(matrix);
        matrix.preTranslate(-(imageWidth / 2.0f), -(imageHeight / 2.0f));
        matrix.postTranslate(imageWidth / 2.0f, imageHeight / 2.0f);
        this.mCamera.restore();
    }
}
